package cn.lili.modules.store.serviceimpl;

import cn.lili.modules.supplier.entity.dos.SupplierAuditRecord;
import cn.lili.modules.store.mapper.SupplierAuditRecordMapper;
import cn.lili.modules.store.service.SupplierAuditRecordService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

@Service
public class SupplierAuditRecordServiceImpl extends ServiceImpl<SupplierAuditRecordMapper, SupplierAuditRecord>
        implements SupplierAuditRecordService {

    public SupplierAuditRecord getBySupplierId (String supplierId) {
        LambdaQueryWrapper<SupplierAuditRecord> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(SupplierAuditRecord::getSupplierId, supplierId);
        queryWrapper.gt(SupplierAuditRecord::getResidueAuditCount, 0);
        queryWrapper.last("limit 1");
        return this.baseMapper.selectOne(queryWrapper);
    }

}
